package com.example.test2018131648.servicetest;

import com.example.test2018131630.bean.UserTable;
import com.example.test2018131630.mapper.UserMapper;
import com.example.test2018131630.service.UserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class servicedemo implements UserService {

    @Resource
    private UserMapper userMapper;

//    登陆
    @Override
    public UserTable loginIn(String username, String password) {
        return userMapper.getInfo(username,password);
    }

//    注册
    @Override
    public int insertUser(UserTable userTable) {
        return userMapper.insertUser(userTable);
    }
//   显示
    @Override
    public List<UserTable> getAllUser() {
        return userMapper.getAllUser();
    }
//  分页
    @Override
    public PageInfo<UserTable> selectUser4Page(Integer page, Integer pageSize) {
        PageHelper.startPage(page,pageSize);
        List<UserTable> users = userMapper.selectUser4Page();
        return new PageInfo<>(users);
    }
}
